<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      >

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </h:head>


    <h:body>

        <script>
            
            var r_text = new Array ();
            r_text[0] = "All the leaves are brown";
            r_text[1] = "And the sky is grey";
            r_text[2] = "I've been for a walk";
            r_text[3] = "On a winter's day";
            r_text[4] = "I'd be safe and warm";
            r_text[5] = "If I was in L.A.";
            r_text[6] = "California dreaming, On such a winter's day";
            var i = Math.floor(7*Math.random())
            document.write(r_text[i]);

        </script>

        
        <h:form>

            <h:selectOneMenu id="sellCurrency" value="#{ExchangeBean.sellCurrency}" >
                <f:selectItems value="#{ExchangeBean.currencies}"/>
                <f:ajax/>
            </h:selectOneMenu>
            <h:selectOneMenu id="buyCurrency" value="#{ExchangeBean.buyCurrency}">
                <f:selectItems value="#{ExchangeBean.currencies}"/>
                <f:ajax/>
            </h:selectOneMenu>

            <h:commandButton value="Get exchange coefficient" action="#{ExchangeBean.getCoefficient()}">
                <f:ajax render="exchangeCoeff"/>
            </h:commandButton>

            <h:outputText value="#{ExchangeBean.coefficient}" id="exchangeCoeff"/>

        </h:form>


    </h:body>
</html>